package com.cy.sys.controller;

import com.cy.common.pojo.JsonResult;
import com.cy.sys.dao.RoleDao;
import com.cy.sys.pojo.Rolemenu;
import com.cy.sys.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@ResponseBody
@RequestMapping("/role/")
public class sysRoleController {
    @Autowired
    private RoleService role;


    @RequestMapping("doFindPageObjects")
    public JsonResult doFindPageObjects(String username,Long pageCurrent ){
        return new JsonResult(role.doFindPageObjects(username, pageCurrent));
    }
    @RequestMapping("doFindObjectById")
    public JsonResult doFindObjectById(Integer id){
            Rolemenu list=role.doFindObjectById(id);
        System.out.println(list);
        return  new JsonResult(list);
    }
    @RequestMapping("doDeleteObject")
    public JsonResult doDeleteObject(Integer id){
        role.doDeleteObject(id);
        return  new JsonResult("delete ok");
    }
    @RequestMapping("doSaveObject")
    public JsonResult doSaveObject(Rolemenu rolemenu){
        role.doSaveObject(rolemenu);
        return new JsonResult("insert ok");
    }
    @RequestMapping("doUpdateObject")
    public JsonResult doUpdateObject(Rolemenu rolemenu){
        role.doUpdateObject(rolemenu);
        return new JsonResult("updata ok");
    }
    @RequestMapping("doFindRoles")
    public JsonResult doFindRoles(Integer id){
        System.out.println("为什么为什么");
        return new JsonResult(role.doFindRoles(id));
    }


}
